﻿using UnityEngine;
using System.Collections;

public class Scores : MonoBehaviour {

    public int PlayerScore { get; set; }
    public int OpponentScore { get; set; }
	public GUIText player;
	public GUIText opponent;

    /// <summary>
    /// Called at the creation of the game.
    /// </summary>
	void Start () {
        // initialization of the scores
        PlayerScore = 0;
        OpponentScore = 0;
		setScores ();
	}

    /// <summary>
    /// Increases the score of player 1 or player 2.
    /// </summary>
    /// <param name="PlayerType">player = 1, opponent = 2.</param>
	public void IncreaseScore(int PlayerType){
		if (PlayerType == 1) {
			PlayerScore++;
		}
		else if(PlayerType == 2){
			OpponentScore++;
		}
		else{
			print ("Increasing score for unknown player !");
		}

		setScores ();
	}

    /// <summary>
    /// change the view with the score values.
    /// </summary>
	void setScores(){
		player.text = PlayerScore.ToString ();
		opponent.text = OpponentScore.ToString ();
	}
}
